<template>
	<div class="myintergralwrap">
		<div class="myintergralwrap-title">最近浏览</div>
		<div class="mycollect-text" v-if="datas!=''">
			<div class="mycollect-food clear" v-for="data in datas" :key="data.id">
				<div class="deleatfood" @click="quxiaocollect" :collect="data.id">x</div>
				<div class="mycollect-food-img"><img :src="data.foodimg" alt=""></div>
				<div class="mycollect-food-name">{{data.foodname}}</div>
				<div class="mycollect-food-text">{{data.foodtext}}</div>
				<div class="mycollect-food-money"><span>￥{{data.foodnewmoney}}</span><span v-if="data.foodoldmoney!=''">￥{{data.foodoldmoney}}</span><i class="iconfont icon-gouwuche"></i></div>
			</div>
		</div>
		<div class="nullcollect" v-if="datas==''">我的收藏为空</div>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				datas:null,
			}
		},
		// created(){
		// 	var userphone=localStorage.getItem("userphone");
		// 	var _this=this;
		// 	this.$axios.post("http://localhost:3000/userinfor/userbrowse",{userphone:userphone})
		// 	.then(function(response){
		// 		var list=response.data;
		// 		if(list.code==200){
		// 			_this.datas=list.data;
		// 			localStorage.setItem("userid",list.userid)
		// 		}
		// 	}).catch(function (error) {
		// 			window.console.log(error);
		// 		})
		// },
		// methods:{
		// 	quxiaocollect(e){
		// 		var userphone=localStorage.getItem("userphone");
		// 		// var _this=this;
		// 		var id=e.target.getAttribute('collect');
		// 		window.console.log(id)
		// 		this.$axios.post("http://localhost:3000/userinfor/deleatbrowse",{userphone:userphone,id:id})
		// 		.then(function(response){
		// 			var list=response.data;
		// 			if(list.code==200){
		// 				alert("删除成功");
		// 				location.reload();
		// 			}
		// 		}).catch(function (error) {
		// 				window.console.log(error);
		// 			})
		// 	}
		// }
	}
</script>

<style>
	.deleatfood{
		position: absolute;
		right: 5px;
		top: 5px;
		width: 20px;
		height: 20px;
		line-height: 20px;
		text-align: center;
		background: #00B066;
		color: white;
		font-size: 20px;
		border-radius: 50%;
		cursor: pointer;
	}
</style>
